package util.redis;

import redis.clients.jedis.Jedis;

/**
 * 连接redis 数据库
 *
 * Created by J.Chen on 2017/5/19.
 */
public class RedisConnect {
    public static Jedis connect(RedisConf conf) {
//        Jedis jedis = new Jedis(String.format("redis://:%s@localhost:%d/%d", conf.getRpwd(), conf.getLport(), conf.getRdbIndex()));
        Jedis jedis = new Jedis(String.format("localhost",conf.getRdbIndex()),conf.getLport(),3000);
        jedis.auth(conf.getRpwd());
        jedis.select(conf.getRdbIndex());
        return jedis;
    }

}
